'use strict';
const db = uniCloud.database();
const dbcmd = db.command
exports.main = async (event, context) => {
	//event为客户端上传的参数
	console.log(event)
	let res = await  db.collection("comment").where(
	   {artileid:dbcmd.in(event.pid)}
	).get()
	
	res.data = res.data.map(item => {
	   return {
	     ...item,
	     id: item._id,
	     _id: undefined // 删除原来的_id字段
	   };
	 });
	 return res;

	
	//返回数据给客户端
	return res
};
